﻿using System;
using TracNghiemChonTruong.Class;

namespace TracNghiemChonTruong
{
    public partial class ResultPage : System.Web.UI.Page
    {
        private const string ViewItem = "Xem chi tiết các ngành nghề tương ứng của nhóm {0}";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (SessionUtils.FullName == null)
            {
                Response.Redirect("/Index.aspx");
            }

            if(!IsPostBack)
            {
                mark1.Text = SessionUtils.Mark1;
                mark2.Text = SessionUtils.Mark2;
                mark3.Text = SessionUtils.Mark3;
                mark4.Text = SessionUtils.Mark4;
                mark5.Text = SessionUtils.Mark5;
                mark6.Text = SessionUtils.Mark6;

                Label1.Text = Define.Marks[SessionUtils.Mark1];
                Label2.Text = Define.Marks[SessionUtils.Mark2];
                Label3.Text = Define.Marks[SessionUtils.Mark3];
                Label4.Text = Define.Marks[SessionUtils.Mark4];
                Label5.Text = Define.Marks[SessionUtils.Mark5];
                Label6.Text = Define.Marks[SessionUtils.Mark6];

                link1.Text = string.Format(ViewItem, SessionUtils.Mark1);
                link2.Text = string.Format(ViewItem, SessionUtils.Mark2);
                link3.Text = string.Format(ViewItem, SessionUtils.Mark3);
                link4.Text = string.Format(ViewItem, SessionUtils.Mark4);
                link5.Text = string.Format(ViewItem, SessionUtils.Mark5);
                link6.Text = string.Format(ViewItem, SessionUtils.Mark6);

                link1.ToolTip = Define.Details[SessionUtils.Mark1];
                link2.ToolTip = Define.Details[SessionUtils.Mark2];
                link3.ToolTip = Define.Details[SessionUtils.Mark3];
                link4.ToolTip = Define.Details[SessionUtils.Mark4];
                link5.ToolTip = Define.Details[SessionUtils.Mark5];
                link6.ToolTip = Define.Details[SessionUtils.Mark6];

                link1.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark1;
                link2.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark2;
                link3.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark3;
                link4.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark4;
                link5.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark5;
                link6.NavigateUrl = "/JobPage.aspx?Id=" + SessionUtils.Mark6;


                SessionUtils.Best = mark1.Text;
                SessionUtils.Second = mark2.Text;
            }
        }


        protected void RaiseBackEvent(object sender, EventArgs e)
        {
            Response.Redirect("/Default.aspx");
        }

        protected void RaiseSearchEvent(object sender, EventArgs e)
        {
            Response.Redirect("/SearchPage.aspx");
        }
    }
}